//
//  WYTSyncView.m
//  Diary
//
//  Created by 王艺拓 on 15/11/11.
//  Copyright © 2015年 王艺拓. All rights reserved.
//

#import "WYTSyncView.h"
#import "WYTDevicesTool.h"

@implementation WYTSyncView

- (instancetype)init{
    self = [super init];
    if (self) {
        [self setUpScenes];
        self.backgroundColor = [UIColor whiteColor];
    }
    return self;
}

- (void)setUpScenes{
    self.descriptionLabel = [[UILabel alloc]initWithFrame:CGRectMake(kScreenWidth * 0.805 * 0.05, kScreenWidth * 0.805 * 0.05, kScreenWidth * 0.805 * 0.9, kScreenWidth * 0.805 * 0.4)];
    self.descriptionLabel.numberOfLines = 0;
    self.descriptionLabel.textAlignment = NSTextAlignmentCenter;
    self.descriptionLabel.text = @"在登录的情况下,将会把您的日记卡片同步至云端.建议打开无线网络\n\n下滑返回设置";
    self.descriptionLabel.textColor = [UIColor grayColor];
    NSInteger descriptionLabelFontSize = 19;
    if ([WYTDevicesTool iPhone6_iPhone6s]) {
        descriptionLabelFontSize = 17;
    }else if ([WYTDevicesTool iPhone320_DEVICES]){
        descriptionLabelFontSize = 15;
    }
    self.descriptionLabel.font = [UIFont boldSystemFontOfSize:descriptionLabelFontSize];
    [self addSubview:self.descriptionLabel];
    
    UIView *conView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.descriptionLabel.frame), (CGRectGetMaxY(self.descriptionLabel.frame) + kScreenWidth * 0.805 * 0.23 / 2), CGRectGetWidth(self.descriptionLabel.frame), kScreenWidth * 0.805 * 0.23 / 2)];
    conView.backgroundColor = [UIColor colorWithRed:253/255.0 green:218/255.0 blue:89/255.0 alpha:1.0f];
    [self addSubview:conView];
    
    UIView *synView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMinX(conView.frame), CGRectGetMaxY(conView.frame), CGRectGetWidth(conView.frame), CGRectGetHeight(conView.frame))];
    synView.backgroundColor = [UIColor orangeColor];
    [self addSubview:synView];
    
    self.confirmButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.confirmButton.frame = CGRectMake(CGRectGetMinX(self.descriptionLabel.frame), CGRectGetMaxY(self.descriptionLabel.frame), CGRectGetWidth(self.descriptionLabel.frame), kScreenWidth * 0.805 * 0.23);
    self.confirmButton.backgroundColor = [UIColor colorWithRed:253/255.0 green:218/255.0 blue:89/255.0 alpha:1.0f];
    self.confirmButton.titleLabel.font = [UIFont boldSystemFontOfSize:descriptionLabelFontSize];
    [self.confirmButton setTitle:@"同步至云端" forState:UIControlStateNormal];
    self.confirmButton.layer.cornerRadius = 10.0;
    self.confirmButton.layer.masksToBounds = YES;
    [self addSubview:self.confirmButton];
    
    
    self.syncDownButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.syncDownButton.frame = CGRectMake(CGRectGetMinX(self.confirmButton.frame), CGRectGetMaxY(self.confirmButton.frame), CGRectGetWidth(self.confirmButton.frame), CGRectGetHeight(self.confirmButton.frame));
    self.syncDownButton.backgroundColor = [UIColor orangeColor];
    self.syncDownButton.titleLabel.font = [UIFont boldSystemFontOfSize:descriptionLabelFontSize];
    [self.syncDownButton setTitle:@"从云端同步至本设备" forState:UIControlStateNormal];
    self.syncDownButton.layer.cornerRadius = 10.0;
    self.syncDownButton.layer.masksToBounds = YES;
    [self addSubview:self.syncDownButton];
}

@end
